import {baseRequest} from '@/utils/request'

const request = (url, ...arg) => baseRequest(`/port-mapping/` + url, ...arg)


export default {
	async fetchList(query) {
		return await request('page', query, 'get')
	},
	async createUserPortMapping(data) {
		return await request('create', data, 'post')
	},
	async updateUserPortMapping(data) {
		return await request('update', data, 'post')
	},
	async deletePortMapping(id) {
		return await request('delete', {
			id: id
		}, 'post')
	},
	async updateEnableStatus(id, enable) {
		return await request('update/enable-status', {
			id: id,
			enable: enable
		}, 'post')
	},
	async portMappingBindSecurityGroup(id, securityGroupId) {
		return await request('bind/security-group', {
			id: id,
			securityGroupId: securityGroupId
		}, 'post')
	},
	async portMappingUnbindSecurityGroup(id) {
		return await request(`unbind/security-group?id=${id}`, {
			id: id,
			securityGroupId: securityGroupId
		}, 'post')
	},
}

